package de.grosjohann.android.feuerwehr.domain;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import android.graphics.Color;
import de.grosjohann.android.feuerwehr.type.FireIndexType;

public class FireIndex
  implements Serializable {

  private final FireIndexType level;
  private final int color;

  public FireIndex(JSONObject obj) throws JSONException {
    color = Color.parseColor(obj.getString("color"));
    level = FireIndexType.valueOf(obj.getInt("level"));
  }

  public FireIndexType getLevel() {
    return level;
  }

  public int getColor() {
    return color;
  }

  @Override
  public String toString() {
    return level.name();
  }
}
